import Vue from 'vue';
import VueResource from 'vue-resource';
import discover from './discover.vue';
import common from "../../assets/js/common.js";

Vue.use(VueResource);

var backUrl = common.isdev()+"/user/checkLogin.htm"; // 检测登录        
var hrefUrl = window.location.href; // 当前链接

// url存在userInfo信息 
if(hrefUrl.indexOf("?userInfo=") > -1){
    // userInfo信息缀回在 回调url中
    backUrl = backUrl + hrefUrl.substring(hrefUrl.indexOf("?userInfo="));
}

// 检测登陆请求
var promise = Vue.http.post(backUrl).then(function(d) {
    console.info('success');
}, function(err) {
   console.info('err');
});

promise.then(function ( response ) {
    new Vue({
        el: '#app',   
        render: h => h(discover)
    });
    // 成功回调
}, function ( response ) {
    new Vue({
        el: '#app',  
        render: h => h(discover)
    });
});